<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/jquery.min.js"></script>
</head>
<style>
    .joke{
        width: 400px;
        background-color: greenyellow;
        color: honeydew;
        margin: 10px auto;
        height: 100px;
        overflow: scroll;
        padding: 10px;
    }
</style>
<body>
    <div>三个笑话</div>
</body>
<script>
    $(function(){
        var url="https://autumnfish.cn/api/joke/list?num=3";
        // $.get(url,function(data,status){
        //    console.log("数据"+data+"\n状态"+status);
        // });
        //采用复杂写法
        $.ajax({
            // headers:{token:tk},  token属性
            url:url,
            type:"GET",
            // data:{"stname":"sb","pass":22},
            success:function(ret){
                for(i in ret.jokes){
                // console.log(ret.jokes[i]);
                var xh=ret.jokes[i];
                $("<div class='joke'></div>").text(xh).appendTo("body");
                }
            },
            error:function(){
                
            }
        })
    })
</script>
</html>